This page last changed on Dec 19, 2006 by juanca.
- FL(S) := {ε}
- for each A ∈ N - {S} do
FL(A) := ∅
- repeat
foreach A ∈ N do
FL'(A) := FL(A)
foreach A → X1X2...Xn ∈ P do
L := FL'(A)
for i := n downto 1 do
L := FIRSTk(Xi+1)⋅k L
if Xi ∈ N then
FL(Xi) := FL(Xi) ∪ L
end for
end for
until FL(A) = FL'(A) ∀ A ∈ N
- FOLLOWk(A) := FL(A)
Otra versión del mismo algoritmo es:
- FL(S) := {ε}
- for each A ∈ N - {S} do
FL(A) := ∅
- repeat
foreach A ∈ N do
FL'(A) := FL(A)
foreach A → X1X2...Xn ∈ P do
for i := n downto 1 do
if Xi ∈ N then
FL(Xi) := FL(Xi) ∪ FIRSTk(Xi+1) ⋅k FIRSTk(Xi+2) ⋅k ... ⋅k FIRSTk(Xn) ⋅k FL'(A)
end for
end for
until FL(A) = FL'(A) ∀ A ∈ N
- FOLLOWk(A) := FL(A)
|